@dataknut)If you wish to use any of the material from this report please cite as:
This work is (c) 2018 the University of Southampton.
This report uses the safe version of the grid spy 1 minute data which has been processed using https://github.com/dataknut/nzGREENGridDataR/blob/master/dataProcessing/gridSpy/processGridSpy1mData.R.
This work was supported by:
We do not ‘support’ the code but if you have a problem check the issues on our repo and if it doesn’t already exist, open one. We might be able to fix it :-)
This report provides summary analysis of one household as an example.
The data used to generate this report is:
## Parsed with column specification:
## cols(
## sample = col_character(),
## hhID = col_character(),
## newID = col_character(),
## Location = col_character(),
## nAdults = col_integer(),
## nChildren0_12 = col_integer(),
## nTeenagers13_18 = col_integer(),
## notes = col_character(),
## r_stopDate = col_date(format = "")
## )
## Warning in kable_styling(., bootstrap_options = c("striped", "hover"),
## font_size = 9): Please specify format in kable. kableExtra can customize
## either HTML or LaTeX outputs. See https://haozhu233.github.io/kableExtra/
## for details.
| sample | hhID | newID | Location | nAdults | nChildren0_12 | nTeenagers13_18 | notes | r_stopDate |
|---|---|---|---|---|---|---|---|---|
| Powerco | rf_06 | rf_06 | New Plymouth | 2 | 0 | 0 | NA | NA |
Table @ref(tab:hhData) shows household attributes such as how many people live in this household.
Table @ref(tab:gsData) shows the initial grid spy 1 minute power data.
## Warning in kable_styling(., bootstrap_options = c("striped", "hover"),
## font_size = 9): Please specify format in kable. kableExtra can customize
## either HTML or LaTeX outputs. See https://haozhu233.github.io/kableExtra/
## for details.
| hhID | dateTime_orig | TZ_orig | r_dateTime | circuit | powerW |
|---|---|---|---|---|---|
| rf_06 | 2014-06-09 10:17 | date NZ | 2014-06-08 22:17:00 | Lighting$2244 | 968.14 |
| rf_06 | 2014-06-09 10:17 | date NZ | 2014-06-08 22:17:00 | Laundry, Downstairs & Lounge$2245 | 437.53 |
| rf_06 | 2014-06-09 10:17 | date NZ | 2014-06-08 22:17:00 | Kitchen$2246 | 25.64 |
| rf_06 | 2014-06-09 10:17 | date NZ | 2014-06-08 22:17:00 | Oven & Hob$2247 | 0.00 |
| rf_06 | 2014-06-09 10:17 | date NZ | 2014-06-08 22:17:00 | Hot Water - Controlled$2248 | 0.00 |
| rf_06 | 2014-06-09 10:17 | date NZ | 2014-06-08 22:17:00 | Incomer - Uncontrolled$2249 | 1629.25 |
Note that:
dateTime_orig) and TZ (TZ_orig) have been retained so that the user can check for parsing errors (see https://github.com/dataknut/nzGREENGridDataR/issues/2) if required;# r_dateTime will have loaded as UTC (if you don't believe me, check :-)
gsDT <- gsDT[, r_dateTime := with_tz(r_dateTime, tzone = "Pacific/Auckland")]
t <- head(gsDT)
gsDT <- gsDT[, obsDate := lubridate::date(r_dateTime)]
gsDT <- gsDT[, obsTime := hms::as.hms(r_dateTime)]
kableExtra::kable(t, caption = paste0("Summary of grid spy data for", params$hhID, "tz corrected")) %>%
kable_styling(bootstrap_options = c("striped", "hover"), font_size = 9)
## Warning in kable_styling(., bootstrap_options = c("striped", "hover"),
## font_size = 9): Please specify format in kable. kableExtra can customize
## either HTML or LaTeX outputs. See https://haozhu233.github.io/kableExtra/
## for details.
| hhID | dateTime_orig | TZ_orig | r_dateTime | circuit | powerW |
|---|---|---|---|---|---|
| rf_06 | 2014-06-09 10:17 | date NZ | 2014-06-09 10:17:00 | Lighting$2244 | 968.14 |
| rf_06 | 2014-06-09 10:17 | date NZ | 2014-06-09 10:17:00 | Laundry, Downstairs & Lounge$2245 | 437.53 |
| rf_06 | 2014-06-09 10:17 | date NZ | 2014-06-09 10:17:00 | Kitchen$2246 | 25.64 |
| rf_06 | 2014-06-09 10:17 | date NZ | 2014-06-09 10:17:00 | Oven & Hob$2247 | 0.00 |
| rf_06 | 2014-06-09 10:17 | date NZ | 2014-06-09 10:17:00 | Hot Water - Controlled$2248 | 0.00 |
| rf_06 | 2014-06-09 10:17 | date NZ | 2014-06-09 10:17:00 | Incomer - Uncontrolled$2249 | 1629.25 |
gsDT <- gsDT[, month := lubridate::month(r_dateTime, label = TRUE)]
gsDT <- gsDT[, year := lubridate::year(r_dateTime)]
Figure @ref(fig:plotProfiles) shows plots overall mean power (W) per minute per month for each circuit to show:
Figure @ref(fig:plotProfiles) in rf_38 seems to indicate some potential time of day mis-alignments in late 2016. We suspect these may be due to incorrect date formats.
Figure @ref(fig:dateCheck) checks the original date format by month and year.
Figure @ref(fig:plotlyProfiles) repeats the original power demand analysis but just for the few ‘doubtful’ months so that we can check and also compare with another household where we do not see this (e.g. rf_06). It uses plotly to generate an interactive plot (html only).
## Warning in kable_styling(., bootstrap_options = c("striped", "hover"),
## font_size = 9): Please specify format in kable. kableExtra can customize
## either HTML or LaTeX outputs. See https://haozhu233.github.io/kableExtra/
## for details.
| hhID | dateTime_orig | TZ_orig | r_dateTime | circuit | powerW | obsDate | obsTime | month | year |
|---|---|---|---|---|---|---|---|---|---|
| rf_06 | 2016-10-01 02:01 | date NZ | 2016-10-01 02:01:00 | Lighting$2244 | 0.00 | 2016-10-01 | 02:01:00 | Oct | 2016 |
| rf_06 | 2016-10-01 02:01 | date NZ | 2016-10-01 02:01:00 | Laundry, Downstairs & Lounge$2245 | 220.19 | 2016-10-01 | 02:01:00 | Oct | 2016 |
| rf_06 | 2016-10-01 02:01 | date NZ | 2016-10-01 02:01:00 | Kitchen$2246 | 50.35 | 2016-10-01 | 02:01:00 | Oct | 2016 |
| rf_06 | 2016-10-01 02:01 | date NZ | 2016-10-01 02:01:00 | Oven & Hob$2247 | 0.00 | 2016-10-01 | 02:01:00 | Oct | 2016 |
| rf_06 | 2016-10-01 02:01 | date NZ | 2016-10-01 02:01:00 | Hot Water - Controlled$2248 | 0.00 | 2016-10-01 | 02:01:00 | Oct | 2016 |
| rf_06 | 2016-10-01 02:01 | date NZ | 2016-10-01 02:01:00 | Incomer - Uncontrolled$2249 | 447.32 | 2016-10-01 | 02:01:00 | Oct | 2016 |
| rf_06 | 2016-10-01 02:02 | date NZ | 2016-10-01 02:02:00 | Lighting$2244 | 0.00 | 2016-10-01 | 02:02:00 | Oct | 2016 |
| rf_06 | 2016-10-01 02:02 | date NZ | 2016-10-01 02:02:00 | Laundry, Downstairs & Lounge$2245 | 214.49 | 2016-10-01 | 02:02:00 | Oct | 2016 |
| rf_06 | 2016-10-01 02:02 | date NZ | 2016-10-01 02:02:00 | Kitchen$2246 | 59.86 | 2016-10-01 | 02:02:00 | Oct | 2016 |
| rf_06 | 2016-10-01 02:02 | date NZ | 2016-10-01 02:02:00 | Oven & Hob$2247 | 0.00 | 2016-10-01 | 02:02:00 | Oct | 2016 |
Figure @ref(fig:checkDoubtfulDates) repeats the earlier analysis but shows just the ‘doubtful’ months. If the plots do not show multiple date formats then it seems unlikely there is an issue.
Analysis completed in 77.4 seconds ( 1.29 minutes) using knitr in RStudio with R version 3.5.0 (2018-04-23) running on x86_64-apple-darwin15.6.0.
R packages used:
Session info:
## R version 3.5.0 (2018-04-23)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS High Sierra 10.13.6
##
## Matrix products: default
## BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
##
## locale:
## [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] kableExtra_0.9.0 hms_0.4.2 rmarkdown_1.10
## [4] knitr_1.20 readr_1.1.1 plotly_4.8.0
## [7] ggplot2_3.0.0 lubridate_1.7.4 data.table_1.11.4
## [10] nzGREENGrid_0.1.0
##
## loaded via a namespace (and not attached):
## [1] Rcpp_0.12.18 lattice_0.20-35 tidyr_0.8.1
## [4] png_0.1-7 assertthat_0.2.0 rprojroot_1.3-2
## [7] digest_0.6.15 mime_0.5 R6_2.2.2
## [10] plyr_1.8.4 backports_1.1.2 evaluate_0.11
## [13] httr_1.3.1 highr_0.7 pillar_1.3.0
## [16] RgoogleMaps_1.4.2 rlang_0.2.1 lazyeval_0.2.1
## [19] rstudioapi_0.7 geosphere_1.5-7 proto_1.0.0
## [22] labeling_0.3 stringr_1.3.1 htmlwidgets_1.2
## [25] munsell_0.5.0 shiny_1.1.0 compiler_3.5.0
## [28] httpuv_1.4.5 pkgconfig_2.0.1 htmltools_0.3.6
## [31] openssl_1.0.2 tidyselect_0.2.4 tibble_1.4.2
## [34] viridisLite_0.3.0 crayon_1.3.4 dplyr_0.7.6
## [37] withr_2.1.2 later_0.7.3 grid_3.5.0
## [40] jsonlite_1.5 xtable_1.8-2 gtable_0.2.0
## [43] magrittr_1.5 scales_0.5.0 stringi_1.2.4
## [46] mapproj_1.2.6 reshape2_1.4.3 promises_1.0.1
## [49] bindrcpp_0.2.2 sp_1.3-1 xml2_1.2.0
## [52] rjson_0.2.20 tools_3.5.0 Cairo_1.5-9
## [55] ggmap_2.6.1 glue_1.3.0 purrr_0.2.5
## [58] maps_3.3.0 crosstalk_1.0.0 jpeg_0.1-8
## [61] yaml_2.2.0 colorspace_1.3-2 rvest_0.3.2
## [64] bindr_0.1.1
Dowle, M, A Srinivasan, T Short, S Lianoglou with contributions from R Saporta, and E Antonyan. 2015. Data.table: Extension of Data.frame. https://CRAN.R-project.org/package=data.table.
Grolemund, Garrett, and Hadley Wickham. 2011. “Dates and Times Made Easy with lubridate.” Journal of Statistical Software 40 (3): 1–25. http://www.jstatsoft.org/v40/i03/.
R Core Team. 2016. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
Wickham, Hadley. 2009. Ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. http://ggplot2.org.
Wickham, Hadley, Jim Hester, and Romain Francois. 2016. Readr: Read Tabular Data. https://CRAN.R-project.org/package=readr.
Xie, Yihui. 2016. Knitr: A General-Purpose Package for Dynamic Report Generation in R. https://CRAN.R-project.org/package=knitr.